Guide to linux boot sequence
=Boot Sequence= # bootloader # linux kernel # inittab #* /etc/inittab # rc script (differs depending on which linux distribution ## init ### Background processes (network, system logging, cron, ...) ##* kernel modules ##** by udev, kudzu, or hardcoded # login #* For graphical: See Graphical #* For text mode: See Text Mode Bootloader Grub and lilo are the most popular bootloaders. They can load any OS any bootable drive or partition. They also pass kernel parameters to the Linux kernel. Configuration Files: * /boot/grub/grub.conf Configuration: * See: Howto configure Grub * See: Howto configure lilo Kernel The linux kernel boots up using the kernel parameters sent by the bootloader. The only other configuration to the kernel is done when compiling the kernel. * See: Howto use Linux kernel parameters * See: Howto compile the Linux kernel inittab After the kernel is loaded the first script to be run is inittab. This sets the runlevel, how to shutdown and use Ctrl-Alt-Del. It also sets the login program and executes the rc script. Configuration File: * /etc/inittab Configuration: * See: Howto configure inittab rc script (sysinit) The rc scripts differ from distribution to distribution, but they all do the same basic thing. They load the desired kernel modules and run the init scripts for the runlevel. The init scripts load the desired background processes, and are added or removed to each runlevel. The main rc script is generally not changed and init scripts and kernel modules are set by a program or setting file. Main rc script: * for Redhat Linux: /etc/rc.d/rc.sysinit * for Gentoo Linux: /sbin/rc sysinit Configuration: * Howto configure the Linux init system init scripts The init script run basic background processes, or programs. They are started by sysinit at boot up, however they can be started, stopped and restarted at any time. Examples of init scripts: anacron, crond, famd, vsftpd, httpd, sendmail Init scripts location: * /etc/rc.d/init.d/ or /etc/init.d/ Init scripts enabled/disable for each runtime (not recommended). * /etc/rc.d/rc0-6.d/ ;Add/remove programs (recommended): * for Redhat Linux: chkconfig * for Gentoo Linux: rc-update Text Mode For Graphical Login See Graphical Login Mode Below After login the start up scripts depend on what's the default shell. Theses scripts are standard shell scripts. Bash Shell scripts automatically loaded for a login terminal. Listed in the order they are executed. * /etc/profile ** Gentoo: /etc/profile.d/*.sh * /etc/bash/bashrc or /etc/bashrc * ~/.bash_profile *:if( ~/.bash_profile doesn't exists ) *:: ~/.bash_login *::if( ~/.bash_login doesn't exists ) *::: ~/.profile * ~/.bashrc ~/.bash_logout is executed when a login terminal is logging out For a non-login terminal(i.e. xterm, aterm) Listed in the order they are executed. * /etc/bash/bashrc * ~/.bashrc *Howto configure bash startup scripts csh Shell scripts automatically loaded for a login terminal. Listed in the order they are executed. */etc/csh.cshrc */etc/csh.login * ~/.tcshrc * if ~/.tcshrc is not found ** ~/.cshrc, ** ~/.history **~/.login **~/.cshdirs For a non-login terminal(i.e. xterm, aterm) Listed in the order they are executed. */etc/csh.cshrc *~/.tcshrc *~/.cshrc *Howto configure csh or tcsh startup scripts tcsh Same as csh. sh login shells */etc/profile *~/.profile logout: command or script specified using the *trap "command" 0 ksh same as sh zsh Login shells *~/.zshenv *~/.zprofile *~/.zlogin Logout *~/.zlogout Interactive shell *~/.zshenv *~/.zshrc rc Login shells *~/.rcrc sash Seems not to have any. =Graphical Login Mode= ...